//
//  ActivityModels.swift
//  甜言蜜语
//
//  Created by 王剑伟 on 16/6/16.
//  Copyright © 2016年 wl. All rights reserved.
//

import Foundation
import SwiftyJSON

class ActivityModel: NSObject, NewsModelInitProtocol {
    
    var id: Int
    var title: String
    var imgsrc: String
    var integral: String
    var partnum: Int
    var state: String
    var limitstr: String
    var price: Int
    
    required init(json: JSON) {
        id = json["id"].intValue
        title = json["title"].stringValue
        imgsrc = json["imgsrc"].stringValue
        integral = json["integral"].stringValue
        partnum = json["partnum"].intValue
        state = json["state"].stringValue
        limitstr = json["limitstr"].stringValue
        price = json["price"].intValue
    }
}

class ActivityPicsModel: NewsModelInitProtocol {
    var id: Int
    var imgurl: String
    
    required init(json: JSON) {
        id = json["id"].intValue
        imgurl = json["imgurl"].stringValue
    }
}

class ActivityImgsModel: NewsModelInitProtocol {
    var id: Int
    var ref: String
    var pixel: String
    var alt: String
    var src: String
    
    required init(json: JSON) {
        id = json["id"].intValue
        ref = json["ref"].stringValue
        pixel = json["pixel"].stringValue
        alt = json["alt"].stringValue
        src = json["src"].stringValue
    }
}
class Gblist: NewsModelInitProtocol{
    var id: String
    var phone: String
    var name: String
    required init(json: JSON) {
        id = json["id"].stringValue
        phone = json["phone"].stringValue
        name = json["name"].stringValue
    }
}
class EndtimeFormat: NewsModelInitProtocol {
    var minute: String
    var second: String
    var hour: String
    var day: String
    
    required init(json: JSON) {
        minute = json["minute"].stringValue
        second = json["second"].stringValue
        hour = json["hour"].stringValue
        day = json["day"].stringValue
    }
}

class ActivityDetailModel: NSObject, NewsModelInitProtocol {
    
    var id: String
    var title: String
    var introduce: String
    var limit: String
    var limitstr: String
    var body: String
    var imgsrc: String
    var integral: String
    var partnum: String
    var state: String
    var price: String
    var applynum: String
    var commentnum: String
    var endtime: String
    var actorder: String
    var activitypics: [ActivityPicsModel] = []
    var activityimgs: [ActivityImgsModel] = []
    var activityimglcs: [ActivityImgsModel] = []
    var gblist: [Gblist]
    var endtimeformat: EndtimeFormat?
    var taobaourl: String
    required init(json: JSON) {
        id = json["id"].stringValue
        title = json["title"].stringValue
        introduce = json["introduce"].stringValue
        limit = json["limit"].stringValue
        limitstr = json["limitstr"].stringValue
        body = json["body"].stringValue
        imgsrc = json["imgsrc"].stringValue
        integral = json["integral"].stringValue
        partnum = json["partnum"].stringValue
        state = json["state"].stringValue
        price = json["price"].stringValue
        applynum = json["applynum"].stringValue
        commentnum = json["commentnum"].stringValue
        endtime = json["endtime"].stringValue
        actorder = json["actorder"].stringValue
        activitypics = ModelArrayProvider.arrayModel(ActivityPicsModel.self, json: json["activitypics"])!
        activityimgs = ModelArrayProvider.arrayModel(ActivityImgsModel.self, json: json["activityimgs"])!
        activityimglcs = ModelArrayProvider.arrayModel(ActivityImgsModel.self, json: json["activityimglcs"])!
        endtimeformat = EndtimeFormat(json: json["endtimeformat"])
        gblist = ModelArrayProvider.arrayModel(Gblist.self, json: json["gblist"])!
        taobaourl = json["taobaourl"].stringValue
    }
}